{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "from iclientpy import viz"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "模拟数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "data=[{'name': '北京市', 'value': 23014.59}, {'name': '天津市', 'value': 16538.189999999999}, {'name': '河北省', 'value': 29806.110000000001}, {'name': '山西省', 'value': 12766.49}, {'name': '内蒙古自治区', 'value': 17831.509999999998}, {'name': '辽宁省', 'value': 28669.02}, {'name': '吉林省', 'value': 14063.129999999999}, {'name': '黑龙江省', 'value': 15083.67}, {'name': '上海市', 'value': 25123.450000000001}, {'name': '江苏省', 'value': 70116.380000000005}, {'name': '浙江省', 'value': 42886.489999999998}, {'name': '安徽省', 'value': 22005.630000000001}, {'name': '福建省', 'value': 25979.82}, {'name': '江西省', 'value': 16723.779999999999}, {'name': '山东省', 'value': 63002.330000000002}, {'name': '河南省', 'value': 37002.160000000003}, {'name': '湖北省', 'value': 29550.189999999999}, {'name': '湖南省', 'value': 28902.209999999999}, {'name': '广东省', 'value': 72812.550000000003}, {'name': '广西壮族自治区', 'value': 16803.119999999999}, {'name': '海南省', 'value': 3702.7600000000002}, {'name': '重庆市', 'value': 15717.27}, {'name': '四川省', 'value': 30053.099999999999}, {'name': '贵州省', 'value': 10502.559999999999}, {'name': '云南省', 'value': 13619.17}, {'name': '西藏自治区', 'value': 1026.3900000000001}, {'name': '陕西省', 'value': 18021.860000000001}, {'name': '甘肃省', 'value': 6790.3199999999997}, {'name': '青海省', 'value': 2417.0500000000002}, {'name': '宁夏回族自治区', 'value': 2911.77}, {'name': '新疆维吾尔自治区', 'value': 9324.7999999999993}]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "生成等级符号专题图，指定样式，地址字段，value字段"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "chart=viz.ranksymboltheme(data, address_key='name',value_key='value',is_over_lay=True,codomain=(0,40000),fill_opacity=0.5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "显示地图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a249d086e9474a3da003a3450e1ae51b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "MapView(basemap={'url': 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'max_zoom': 19, 'attribution': '…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可视化交互，动态调整专题图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ce668d38e0b640b68469f24815d1e5c3",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "VBox(children=(IntRangeSlider(value=(1000, 40000), continuous_update=False, description='值域范围:', layout=Layout…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "chart.interact()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
